import axios from '@/api/fetch';
import * as types from './types';
import SERVER from '@/api/server';

// 服务活动页面 table
export const getFwhdList = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/queryActivityValid`, { params });

// 维修组合页面左下table 请求
export const getWxzhZxList = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/group/findGroupItem`, { params });

// 维修组合页面右上 table
export const getWxzhYsList = (row, params) => {
  function toZero(flag) {
    return flag === null || flag === '' ? 0 : flag;
  }
  return axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/group/findRepairProject/${toZero(row.PACKAGE_CODE)}/${toZero(row.PACKAGE_NAME)}/1`, { params });
};

// 维修组合页面右下 table
export const getWxzhYxList = (row, params) => {
  function toZero(flag) {
    return flag === null || flag === '' ? 0 : flag;
  }
  return axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/group/findRepairPart/${toZero(row.PACKAGE_CODE)}/${toZero(row.PACKAGE_NAME)}/1`, { params });
};

// 服务活动明细页面详情数据
export const getFwhdXqList = row => {
  return axios.get(`${SERVER.DMSCLOUD_REPAIR}/market/serviceActivityManage/query/${row.ACTIVITY_CODE}`);
};

// 服务活动明细活动范围选项卡下 （活动车型）
export const getFwhdHdcxList = (row, params) => {
  return axios.get(`${SERVER.DMSCLOUD_REPAIR}/market/serviceActivityManage/queryModel/${row}/`, { params });
};

// 服务活动明细（活动范围）选项卡下 （活动车辆）
export const getFwhdHdclList = (row, params) => {
  return axios.get(`${SERVER.DMSCLOUD_REPAIR}/market/serviceActivityManage/queryVehicle/${row}/`, { params });
};

// 服务活动明细（活动内容）选项卡下 （维修项目）
export const getFwhdWxxmList = (row, params) => {
  return axios.get(`${SERVER.DMSCLOUD_REPAIR}/market/serviceActivityManage/selectlabour/${row}`, { params });
};

// 服务活动明细（活动内容）选项卡下 （备件项目）
export const getFwhdPjxmList = (row, params) => {
  return axios.get(`${SERVER.DMSCLOUD_REPAIR}/market/serviceActivityManage/selectpart/${row}/`, { params });
};

// 服务活动明细（活动内容）选项卡下 （附加项目）
export const getFwhdFjxmList = (row, params) => {
  return axios.get(`${SERVER.DMSCLOUD_REPAIR}/market/serviceActivityManage/selectsubjoin/${row}/`, { params });
};

// 服务活动明细 项目维修类型下拉框
export const getFwhdWxlxList = params => axios.get(`/dms.web/part/rest/basedata/lendStuff/queryType`, { params });

// 服务活动明细 收费区分
export const getFwhdSfList = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/accessoryItem/AccessoryItem/cplist`, { params });

// 服务活动明细 工时单价
export const getFwhdGsdjList = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedataRepairtypes/labourpriceItem`, { params });

// 服务活动明细 仓库代码
export const getFwhdCkdmList = params => axios.get(`/dms.web/part/rest/partStocks/StockCode`, { params });

// 服务活动点击确定触发客户接待 选项卡  （维修项目）
export const getFwhdQdWxxmList = row => {
  return axios.get(`/dms.web/repair/rest/order/repair/queryActivitylabourWithPrice/${row},`);
};

// 服务活动点击确定触发客户接待 选项卡  （维修材料）
export const getFwhdQdWxclList = row => {
  return axios.get(`/dms.web/repair/rest/order/repair/queryActivityPartWithPrice/${row},`);
};

// 服务活动点击确定触发客户接待 选项卡  （附加项目）
export const getFwhdQdfjxmList = row => {
  return axios.get(`/dms.web/repair/rest/order/repair/queryTtActivityAdd/${row},`);
};
